﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows.Media;

namespace Pomo
{
    [ValueConversion(typeof(Pomodoro.StatusType), typeof(Color))]
    class PomoStatusToColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Pomodoro.StatusType status = (Pomodoro.StatusType)value;
            Color color;

            switch (status)
            {
                case Pomodoro.StatusType.WorkPaused: color = Colors.Yellow; break;
                case Pomodoro.StatusType.BreakPaused: color = Colors.Yellow; break;
                case Pomodoro.StatusType.Working: color = Colors.LightGreen; break;
                case Pomodoro.StatusType.Breaking : color = Colors.Blue; break;
                default: color = Colors.Red; break;
            }
            return color;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
            //throw new NotImplementedException("I didn't expect anybody to ever try to convert from color back to status.");
        }
    }

    [ValueConversion(typeof(Pomodoro.StatusType), typeof(Color))]
    class PomoStatusToDarkColorConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Pomodoro.StatusType status = (Pomodoro.StatusType)value;
            Color color;

            switch (status)
            {
                case Pomodoro.StatusType.WorkPaused: color = Colors.Goldenrod; break;
                case Pomodoro.StatusType.BreakPaused: color = Colors.Goldenrod; break;
                case Pomodoro.StatusType.Working: color = Colors.Green; break;
                case Pomodoro.StatusType.Breaking: color = Colors.DarkBlue; break;
                default: color = Colors.DarkRed; break;
            }
            return color;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return null;
            //throw new NotImplementedException("I didn't expect anybody to ever try to convert from color back to status.");
        }
    }

}
